package com.example.demo.component;

import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

@Component
public class JmsComponent {
    @Autowired
    private JmsTemplate jmsTemplate;
    @Autowired
    private ActiveMQQueue activeMQQueue;
    public void sendMessage(String message){
        jmsTemplate.convertAndSend(this.activeMQQueue,message);
    }
    @JmsListener(destination = "test")
    public void reciveMessage(String text){
        System.out.println(text);
    }
}
